<?php

class ClearController extends Controller
{
	public function actionGalleryAll()
	{
		try {
			if(!Comment::model()->deleteAll(TRUE)) {
				throw new PlatwoException(9999, 'Can not delete commentGroup');
			}
			if(!CommentGroup::model()->deleteAll(TRUE)) {
				throw new PlatwoException(9999, 'Can not delete Comment');
			}
			if(!Gallery::model()->deleteAll(TRUE) ){
				throw new PlatwoException(9999, 'Can not delete Gallery');
			}
			if(!PhotoGroup::model()->deleteAll(TRUE)){
				throw new PlatwoException(9999, 'Can not delete PhotoGroup');
			}
			if(!Photo::model()->deleteAll(TRUE)){
				throw new PlatwoException(9999, 'Can not delete Photo');
			}
			if(!Like::model()->deleteAll(TRUE)){
				throw new PlatwoException(9999, 'Can not delete Like');
			}
			if(!LikeGroup::model()->deleteAll(TRUE)){
				throw new PlatwoException(9999, 'Can not delete LikeGroup');
			}
		} catch(PlatwoException $e) {
			echo $e->toJSON();
		}
	}
}